import React from 'react'
import { Form, Input, InputNumber, Switch, Checkbox, message } from 'antd'
import request from '@/utils/request'
const { TextArea } = Input
export default (props: any) => {
    const { saveForm, close, tableRef, id } = props
    const onFinish = (values: any) => {
        request(`/member/tag-save/${id}`, {
            method: 'POST',
            data: { ...values },
        }).then((result) => {
            if (result.code !== 200) {
                message.warning(result.message)
                return
            }
            message.success(result.message, 1, () => {
                close()
                tableRef.current.reload()
            })
        })
    }
    return (
        <Form
            labelCol={{ span: 5 }}
            wrapperCol={{ span: 17 }}
            form={saveForm}
            onFinish={onFinish}
        >
            <Form.Item label="标签名称" name="title" required rules={[{ required: true, message: '等级名称不能为空' }]}>
                <Input />
            </Form.Item>

            <Form.Item label="排序" name="sort" help="排序值必须为整数">
                <InputNumber />
            </Form.Item>
            <Form.Item label="备注" name="remark">
                <TextArea rows={3} />
            </Form.Item>
        </Form>
    )
}